<%@ page language="java" pageEncoding="UTF-8" isErrorPage="true"%>
<%@ include file="/pages/webframework/common/commonInclude.jsp"%>
<%@ page import="com.ce.webframework.exception.*"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<%
			if (request
			.getAttribute(com.ce.webframework.exception.support.StrutsExceptionHandler.WEBX_THE_EXCEPTION_KEY) == null)
		return;
%>
<%
			com.ce.webframework.exception.support.ExceptionWrapper wrapper = (com.ce.webframework.exception.support.ExceptionWrapper) request
			.getAttribute(com.ce.webframework.exception.support.StrutsExceptionHandler.WEBX_THE_EXCEPTION_KEY);
%>

<script>

<%
/*
	if (wrapper.getCode() == null) {
	%>
	alert("you have a error:\r\n"+
  	"exception:"+"<%=wrapper.getCause().getClass().getName()%>"+"\r\n"+
  	"message:"+"<%=wrapper.getMessage()%>"+"\r\n");
	<%
	} else {
	%>
	alert("you have a error:\r\n"+
	"code:"+"<%=wrapper.getCode()%>"+"\r\n"+
  	"type:"+"<%=wrapper.getType()%>"+"\r\n"+
  	"severity:"+"<%=wrapper.getSeverity()%>"+"\r\n"+
  	"description:"+"<%=wrapper.getDescription()%>"+"\r\n"+
  	"url:"+"<%=wrapper.getUrl()%>"+"\r\n"+
  	"message:"+"<%=wrapper.getMessage()%>"+"\r\n");
	<%
	}
*/
%>
<%
	System.out.println("class--->"+wrapper.getCause().getClass().getName());
	String url = "";

	if(wrapper.getCause() instanceof BusinessException){
		BusinessException be = (BusinessException)wrapper.getCause();

		if(wrapper.getMessage() != null){
			if(BusinessException.WARNING.equals(be.getType())){
				url = "/res/pages/webframework/exception/warning.jsp?message="+request.getAttribute("exceptionMessage");
			}else{
				url = "/res/pages/webframework/exception/error.jsp?message="+request.getAttribute("exceptionMessage");
			}

		}
	}else if(wrapper.getCause() instanceof DataAccessException){

		if(wrapper.getMessage() != null){
			url = "/res/pages/webframework/exception/error.jsp?message="+request.getAttribute("exceptionMessage");
		}
	}else{
		url = "/res/pages/webframework/exception/error.jsp?message=未知错误，请联系管理员。";
	}

%>
//alert('<%=wrapper.getMessage()%>');
window.name = 'exception';
var url ='<%=url%>';

url += "."//因为最后一位字符中文会乱码，所以这里增加一个字符，并且在div页面删除它
url =  encodeURI(url);//"&time="+new Date().getTime();
window.parent.windowOpen(url, "exception", '', 185, 380, true, "exceptionIfr", this.window)
//history.go(-1);
</script>
<base href="${ctx}">
<title>异 常</title>
</head>
<body>
</body>
</html>
